package com.cm367.teamc;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;

import com.cm367.teamc.session.UserSession;

@ManagedBean
public class Entrance {

	@ManagedProperty(value = "#{userSession}")
	private UserSession userSession;

	public UserSession getUserSession() {
		return userSession;
	}

	public void setUserSession(UserSession userSession) {
		this.userSession = userSession;
	}

	public String go() {
		if (userSession.getUserID() != null) {
			if (userSession.getRole().equals("Admin")) {
				return "adminHome";
			} else if (userSession.getRole().equals("Manager")) {
				return "managerHome";
			} else {
				return "userHome";
			}
		} else {
			return "eLeaveLogin";
		}
	}

}
